﻿using HtmlAgilityPack;

namespace EasyHttp.Test
{
    public class FindElement
    {
        HtmlDocument doc = new HtmlDocument();

        public FindElement(string text)
        {
            doc.LoadHtml(text);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="xpath"></param>
        /// <returns></returns>
        public HtmlNode ByXPath(string xpath)
        {
            return doc.DocumentNode.SelectSingleNode(xpath);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="xpath"></param>
        /// <returns></returns>
        public HtmlNodeCollection ByXPaths(string xpath)
        {
            return doc.DocumentNode.SelectNodes(xpath);
        }


    }
}
